package com.example.wacoffee_user.listener;


import com.example.wacoffee_user.pojo.vo.pointVo;
import com.example.wacoffee_user.service.IOrderService;
import lombok.RequiredArgsConstructor;
import org.springframework.amqp.rabbit.annotation.*;
import org.springframework.stereotype.Component;

import java.awt.*;

@Component
@RequiredArgsConstructor
public class PayStatusListener {
    private final IOrderService orderService;

    @RabbitListener(bindings = @QueueBinding(
            value = @Queue(name = "point.success.queue", durable = "true"),
            exchange = @Exchange(name = "point.direct"),
            key = "point.success",
            arguments = @Argument(name="x-queue-mode", value = "lazy")
    ))
    public void addPoint(pointVo pointVo) {
        orderService.addPoint(pointVo);
    }
}
